<template>
    <div>
        <van-nav-bar
                left-text="返回"
                left-arrow @click-left="clickBack" :fixed="true" style="background-color: #FFc300">
        </van-nav-bar>
        <!--搜索栏-->
    </div>

</template>

<script>
    export default {
        name: "TopBar",
        data(){
            return{
                isShowSearch:false,
                searchWords:''
            }
        },
        methods:{
            clickBack(){
               let routerPath=this.$store.getters.getPreviousMenu.pop();
                if (!routerPath)return
                if (routerPath.indexOf("commodity")!==-1){
                    this.$bus.$emit("updatePresentIndex",0)
                }else if (routerPath.indexOf("person")!==-1 ||routerPath.indexOf("myOrder")!==-1){
                    this.$bus.$emit("updatePresentIndex",2)
                }else if (routerPath.indexOf("shopping")!==-1){
                    this.$bus.$emit("updatePresentIndex",1)
                }
                this.$router.push(routerPath)
            }
        }
    }
</script>

<style scoped>

</style>
